package com.ganee.agora.repository

import com.ganee.agora.api.MainApiService
import com.ganee.agora.model.*
import com.ganee.baselib.httprequest.callback.RequestCallback
import com.ganee.baselib.mvvmlibrary.base.BaseRepository
import com.ganee.baselib.mvvmlibrary.base.BaseViewModel
import okhttp3.RequestBody

class DetailRepository(baseViewModel: BaseViewModel<*>) : BaseRepository(baseViewModel){

    /**
     * 获取详情
     */
    fun postDetailInfo(body:RequestBody,callback: RequestCallback<DetailEntity>) {
        execute(getApi(MainApiService::class.java).postDetailInfo(body), callback)
    }

    /**
     * 获取已发布列表
     */
    fun getRecommendList(callback: RequestCallback<List<InsertActivityEntity>>) {
        executeQuietly(getApi(MainApiService::class.java).recommendList, callback)
    }

    /**
     * 获取评论列表
     */
    fun getCommentList(body: RequestBody,callback: RequestCallback<List<CommentEntity>>) {
        executeQuietly(getApi(MainApiService::class.java).getCommentList(body), callback)
    }

    /**
     * 获取token
     */
    fun getClientToken(body:RequestBody,callback: RequestCallback<ClientTokenEntity>) {
        executeQuietly(getApi(MainApiService::class.java).getClientToken(body), callback)
    }

    /**
     * 支付接口
     */
    fun postExecutePay(body:RequestBody,callback: RequestCallback<String>) {
        executeQuietly(getApi(MainApiService::class.java).postExecutePay(body),callback)
    }

    /**
     * 收藏
     */
    fun postCollect(body:RequestBody,callback: RequestCallback<Any>) {
        execute(getApi(MainApiService::class.java).postCollect(body), callback)
    }

    /**
     * 取消收藏
     */
    fun postCancelCollect(body:RequestBody,callback: RequestCallback<Any>) {
        execute(getApi(MainApiService::class.java).postCancelCollect(body), callback)
    }

    /**
     * 获取活动邀请
     */
    fun getInviteInfo(body: RequestBody,callback: RequestCallback<InviteInfoEntity>) {
        executeQuietly(getApi(MainApiService::class.java).getInviteInfo(body), callback)
    }

    /**
     * 新增评论信息
     */
    fun postComment(body: RequestBody,callback: RequestCallback<CommentEntity>) {
        executeQuietly(getApi(MainApiService::class.java).postComment(body), callback)
    }

    /**
     * 免费报名
     */
    fun postEnroll(body:RequestBody,callback: RequestCallback<Any>) {
        execute(getApi(MainApiService::class.java).postEnroll(body), callback)
    }
}
